{capture name=css_urls}
	{$default_admin_theme_url}/css/jq-picker.css
{/capture}
{capture name=js_urls}
	{$default_admin_theme_url}/js/jq-picker.js
{/capture}
{capture name=pageTitle}
	{if $dealer.id == "-1"}
		{t}Create New Dealer{/t}
	{else}
		{t}Edit Dealer{/t}
	{/if}
{/capture}
{include file="file:$admin_theme_global_path/_header.tpl" masthead=$smarty.capture.pageTitle pageTitle=$smarty.capture.pageTitle current="dealers_admin_edit" js_urls=$smarty.capture.js_urls css_urls=$smarty.capture.css_urls}
<div class="grid_4 sidenav">
	<h3>{t}Options{/t}</h3>
	<ul>
		<li><a href="{url}/dealers/admin/index{/url}">{t}Back To Dealers{/t}</a></li>
		{if $success ne null and $success ne ""}
			<li><a href="{url}/dealers/admin/edit/id/{$dealer_id}{/url}">{t}Continue Editing{/t}</a></li>
		{/if}
	</ul>
</div>
<div class="grid_12">
	{if $dealer ne null}
		<form action="{url}/dealers/admin/edit/id/{$dealer.id}{/url}" method="post" enctype="multipart/form-data">
			<!-- <legend>Editing: {$dealer.name}</legend> -->
			<input type="hidden" name="dealer_type_id" id="dealer_type_id" value="{$dealer.dealer_type_id}" />
			<h4>{t}Dealer Information{/t}</h4>
			<p>
				<label for="status">{t}Status{/t}</label>
				{html_options name=status options=$statuses selected=$dealer.status}
			</p>
			<p>
				<label for="dealer_code">{t}Dealer ID{/t}</label>
				<input type="text" name="dealer_code" id="dealer_code" value="{$dealer.code}" tabindex="10" />
			</p>
			<p>
				<label for="name">{t}Dealer Name{/t}</label>
				<input type="text" name="name" id="name" value="{$dealer.name}" tabindex="40" />
			</p>
			{if $dealer.dealer_type_id eq 1}
				<p>
					<label for="address1">{t}Address 1{/t}</label>
					<input type="text" name="address1" id="address1" value="{$dealer.address1}" tabindex="50" />
				</p>
				<p>
					<label for="address2">{t}Address 2{/t}</label>
					<input type="text" name="address2" id="address2" value="{$dealer.address2}" tabindex="60" />
				</p>
				<p>
					<label for="city">{t}City/Town{/t}</label>
					<input type="text" name="city" id="city" value="{$dealer.city}" tabindex="60" />
				</p>
				<p>
					<label for="state">{t}State{/t}</label>
					{html_options name=state options=$states selected=$dealer.state}
				</p>
				<p>
					<label for="zip">{t}Zipcode/Postal Code{/t}</label>
					<input type="text" name="zip" id="zip" value="{$dealer.zip}" tabindex="80" />
				</p>
				<p>
					<label for="country_code">{t}Country{/t}</label>
					{html_options name=country_code options=$countries_single_select selected=$dealer.country_code}
				</p>
				<p>
					<label for="intl_calling_code">{t}Intl Calling Code{/t}</label>
					<input type="text" name="intl_calling_code" id="intl_calling_code" value="{$dealer.intl_calling_code}" tabindex="100" />
				</p>
				<p>
					<label for="phone_number">{t}Phone Num{/t}</label>
					<input type="text" name="phone_number" id="phone_number" value="{$dealer.phone_number}" tabindex="110" />
				</p>
			{/if}
			<p>
				<label for="website_url">{t}Website URL{/t}</label>
				<input type="text" name="website_url" id="website_url" value="{$dealer.website_url}" tabindex="120" />
			</p>
			{if $dealer.dealer_type_id eq 1}
				<p>
					<label for="short_description">{t}Short Description{/t}</label>
					<textarea name="short_description" id="short_description" tabindex="130">{$dealer.short_description}</textarea>
				</p>
			{/if}
			{if $dealer.dealer_type_id eq 1}
				<p>
					<label for="latitude">{t}Latitude{/t}</label>
					<input type="text" name="latitude" id="latitude" value="{$dealer.latitude}" tabindex="140" />
				</p>
				<p>
					<label for="longitude">{t}Longitude{/t}</label>
					<input type="text" name="longitude" id="longitude" value="{$dealer.longitude}" tabindex="150" />
				</p>
			{/if}
			{if $dealer.dealer_type_id eq 2}
				<p>
					<label for="logo_filename">{t}Logo Image{/t}</label>
					<input type="text" name="logo_filename" id="logo_filename" value="{$dealer.logo_filename}" tabindex="160" />
					<input type="button" value="Select" class="button" />
				</p>
				<p><label class="full">{t}Countries Sold In{/t}</label></p>
				<p>	
					{html_options
						name="associated_countries[]"
						id="associated_countries"
						options=$countries_multi_select
						selected=$associated_countries_array|""
						multiple="multiple"
						size="10"
						class="jq-picker"}
				</p>
			{/if}
			<h4>{t}Product Categories Carried{/t}</h4>
			<ul class="checkboxlist">
				{foreach from=$dealer_categories item=dealer_category key="index"}
				<li>
					<label><input value="{$index}" name="dealer_categories[]" type="checkbox" 
					{foreach from=$dealer_categories_selected item=selected}
					{if $selected eq $dealer_category} checked="checked"{/if}
					{/foreach} /> {$dealer_category}</label>
				</li>
				{/foreach}
			</ul>
			{if $dealer.dealer_type_id eq 2}
				<h4>{t}Online Data Sync/Referral{/t}</h4>
				<ul class="checkboxlist">
					<li>
						<label>
							<input type="checkbox" name="online_sync" id="online_sync" value="1" {if $dealer.online_sync eq 1}checked="checked"{/if} />
							{t}Enable Online Sync?{/t}
						</label>
					</li>
				</ul>
				<p>
					<label for="online_sync_url">{t}Data Sync URL{/t}</label>
					<input type="text" name="online_sync_url" id="online_sync_url" value="{$dealer.online_sync_url}" tabindex="190" />
				</p>
				{if !$is_new}
					<p>
						<label>{t}Data Sync Status{/t}</label>
						{t}Last Sync Successful{/t}: 1/5/2009, 12:30am CST
					</p>
				{/if}
			{/if}
			<p>
				<input type="submit" class="button submit" value="{t}Save Changes{/t}" />
			</p>
		</form>
	{/if}
</div>
{include file="file:$admin_theme_global_path/_footer.tpl"}
